﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        xmlns:ui="clr-namespace:Pdf2epub.UI" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="Pdf2epub.UI.StyleEditor" 
        Title="StyleEditor" 
        Height="600" 
        Width="800"
        DataContext="{Binding RelativeSource={RelativeSource Self}}" WindowStyle="ToolWindow" WindowStartupLocation="CenterOwner">

    <Window.CommandBindings>
        <CommandBinding Command="ui:StyleEditorCommands.AddNewStyle" CanExecute="OnCanExecuteAddNewStyle" Executed="OnCommandExecuted" />
        <CommandBinding Command="ui:StyleEditorCommands.RemoveSelectedStyle" CanExecute="OnCanExecuteRemoveSelectedStyle" Executed="OnCommandExecuted" />
    </Window.CommandBindings>

    <Grid>

        <DockPanel LastChildFill="True">
            <ToolBar DockPanel.Dock="Top">
                <Button Command="ui:StyleEditorCommands.AddNewStyle">
                    <StackPanel Orientation="Horizontal">
                        <Image Height="24" Width="24" Source="/Resources\24\list-add-3.png" VerticalAlignment="Center" />
                        <TextBlock Padding="3"><Run Text="Create new Style"/></TextBlock>
                    </StackPanel>
                </Button>
                <Button Command="ui:StyleEditorCommands.RemoveSelectedStyle">
                    <StackPanel Orientation="Horizontal">
                        <Image Height="24" Width="24" Source="/Resources\24\list-remove-3.png" VerticalAlignment="Center" />
                        <TextBlock Padding="3"><Run Text="Delete this Style"/></TextBlock>
                    </StackPanel>
                </Button>
            </ToolBar>

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="5" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <ListView Grid.Column="0" 
					x:Name="LvAvailableStyles"
					ItemsSource="{Binding AvailableStyles}"
					SelectionChanged="OnAvailableStylesSelectionChanged">

                    <ListView.View>
                        <GridView>
                            <GridViewColumn 
								Width="Auto" 
								Header="Available Styles"
								DisplayMemberBinding="{Binding StyleName}" />
                        </GridView>
                    </ListView.View>
                </ListView>

                <GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" />

                <Grid Grid.Column="2">

                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="5" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <xctk:PropertyGrid Grid.Row="0" 
						x:Name="PgStyleDetails" 
						IsCategorized="False" 
						ShowSearchBox="False" 
						ShowSortOptions="False" 
						ShowSummary="False" 
						ShowTitle="False" 
						PropertyChanged="OnPropertyChanged" />

                    <GridSplitter Grid.Row="1" Height="5" HorizontalAlignment="Stretch" />

                    <WebBrowser Grid.Row="2" x:Name="WebPreview" />

                </Grid>
            </Grid>
        </DockPanel>
    </Grid>
</Window>
